implimented strategy pattern for start and finish flow#1036
Open
Mental-Block wants to merge 2 commits intoraystack:mainfrom
Open
implimented strategy pattern for start and finish flow#1036Mental-Block wants to merge 2 commits intoraystack:mainfrom
Mental-Block wants to merge 2 commits intoraystack:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the authentication flow system by implementing the strategy pattern to replace if/else conditionals with function maps for both start and finish flows across different authentication methods (OIDC, Mail OTP, Mail Link, PassKey).
- Replaces lengthy if/else chains with strategy pattern using function maps
- Adds new OIDC constant and improves code organization
- Extracts authentication logic into dedicated strategy functions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/authenticate/strategy/oidc.go | Adds OIDCAuthMethod constant for strategy pattern |
| core/authenticate/service.go | Major refactoring to implement strategy pattern with function maps and extract flow logic |
| core/authenticate/authenticate.go | Imports OIDC constant from strategy package |
Comments suppressed due to low confidence (1)
| PassKeyAuthMethod.String(): finishKeyPassFlow, | ||
| MailOTPAuthMethod.String(): finishMailOTPFlow, | ||
| MailLinkAuthMethod.String(): finishMailLinkFlow, | ||
| OIDCAuthMethod.String(): finishOCIDFlow, |
There was a problem hiding this comment.
Function name 'finishOCIDFlow' has a typo. Should be 'finishOIDCFlow' to match the OIDC naming convention.
Comment on lines
+290
to
+293
| return finishMailOTPFlow(s, ctx, request) | ||
| } | ||
|
|
||
| func finishOCIDFlow(s Service, ctx context.Context, request RegistrationFinishRequest) (*RegistrationFinishResponse, error) { |
There was a problem hiding this comment.
Function name 'finishOCIDFlow' has a typo. Should be 'finishOIDCFlow' to match the OIDC naming convention.
Suggested change
| return finishMailOTPFlow(s, ctx, request) | |
| } | |
| func finishOCIDFlow(s Service, ctx context.Context, request RegistrationFinishRequest) (*RegistrationFinishResponse, error) { | |
| return finishOIDCFlow(s, ctx, request) | |
| } | |
| func finishOIDCFlow(s Service, ctx context.Context, request RegistrationFinishRequest) (*RegistrationFinishResponse, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
removed a bunch of if statements in flow in favour of implementing strategy pattern for different auth flow methods. all passes test.